﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TM.Data.Contracts;
using TM.DataAccessor;
using TM.ExceptionManager;
using TM.Model;

namespace TM.Data
{
    public static class RepositoryFactories
    {
        private static IDictionary<Type, object> Repositories(IIoCParams ioCParams)
        {
            return new Dictionary<Type, object>()
                       {
                           {typeof(Project),new ProjectRepository(ioCParams)},
                           {typeof(ProjectTask),new ProjectTaskRepository(ioCParams)},
                           {typeof(Evident),new EvidentRepository(ioCParams)},
                           {typeof(DMNhanVien),new ResourceRepository(ioCParams)},
                           {typeof(Scope),new ScopeRepository(ioCParams)},
                           {typeof(TaskStatus),new TaskStatusRepository(ioCParams)},
                       };

        }

        public static IRepository<T> GetRepository<T>(IIoCParams ioCParams) where T : class
        {
            return (IRepository<T>)Repositories(ioCParams)[typeof(T)];

        }
    }
}
